<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <el-container>
        <el-header style="background-color: #0096dc">
            <h1 STYLE="font-size: 22px;color: white;margin-top: 15px;left: 1px">
                <span style="float: left">
                    <img src="imgs/logo2.png" width="72px" height="56px"  >
                </span>
                <span style="float:right;font-size: 15px ">
                    欢迎{{emp.nickname}}回来
                    <el-button @click="logout()">退出登录</el-button>
                </span>
                xx酒店后台管理系统
            </h1>
        </el-header>
        <el-container>
            <el-aside width="200px" style="overflow: hidden">
                <el-menu >
                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-s-flag"></i>
                            <span>分类管理</span>
                        </template>
                        <el-menu-item index="1-1">内部员工列表</el-menu-item>
                        <el-menu-item index="1-2">添加员工</el-menu-item>
                    </el-submenu>
                    <el-submenu index="2">
                        <template slot="title">
                            <i class="el-icon-picture"></i>
                            <span>图片管理</span>
                        </template>
                        <el-submenu index="2-1">
                            <template slot="title">
                                <span>轮播图</span>
                            </template>
                            <el-menu-item index="2-1-1">轮播图列表</el-menu-item>
                            <el-menu-item index="2-1-2">添加轮播图</el-menu-item>
                        </el-submenu>
                        <el-submenu index="2-2">
                            <template slot="title">
                                <span>客房展示图</span>
                            </template>
                            <el-menu-item index="2-2-1">图片列表</el-menu-item>
                            <el-menu-item index="2-2-2">添加客房图</el-menu-item>
                        </el-submenu>
                    </el-submenu>
                    <el-submenu index="3">
                        <template slot="title">
                            <i class="el-icon-shopping-cart-2"></i>
                            <span>客房管理</span>
                        </template>
                        <el-menu-item index="3-1">客房列表</el-menu-item>
                        <el-menu-item index="3-2">添加客房</el-menu-item>
                    </el-submenu>
                </el-menu>
            </el-aside>
        </el-container>
    </el-container>

</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function() {
            return {
                emp:{}
            }
        },
        methods:{
            logout(){
                axios.get("/admins/logout").then(function () {
                    location.href="/adlogin.html"
                })
            }
        },
        created: function(){
                axios.get("/admins/currentAdmin").then(function (response) {
                    v.emp=response.data;
                    if( v.emp==""){
                            alert("您尚未登录，请登录！")
                            location.href="adlogin.html";
                        }
                })
        }
    })
</script>
</html>